// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
#include "pch.h"
#include "DataModel\ForecastManager.h"
#include "ForecastToButtonColorConverter.h"

using namespace Weathr;
using namespace Platform;
using namespace Windows::UI;
using namespace Windows::UI::Xaml::Media;
using namespace Windows::UI::Xaml::Interop;

SolidColorBrush^ NormalBrush = nullptr;
SolidColorBrush^ SelectedBrush = nullptr;

Object^ ForecastToButtonColorConverter::Convert(Object^ value, TypeName targetType, Object^ parameter, String^ language)
{
    (void) targetType; // Unused parameter
    (void) parameter;  // Unused parameter
    (void) language;   // Unused parameter

    if (SelectedBrush == nullptr)
    {
        SelectedBrush = ref new SolidColorBrush(Colors::Pink);
    }

    auto forecast = safe_cast<Forecast^>(value);
    return forecast == ForecastManager::Current->HomeForecast ? SelectedBrush : NormalBrush;
}

Object^ ForecastToButtonColorConverter::ConvertBack(Object^ value, TypeName targetType, Object^ parameter, String^ language)
{
    (void) targetType; // Unused parameter
    (void) parameter;  // Unused parameter
    (void) language;   // Unused parameter

    throw ref new NotImplementedException();
}